<?php
/* Squawk Content Management System
"Crane"
Written by Max Morgan <max@cridiron.com>

Licensed under GPLv3 (See LICENSE.txt for details)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>. */

// Global config file
// contains site-wide variables
// Edit by hand for quick fixes and changes

/* Development Tags */

$VersNum = "0.0.P.1";							// Version number
$VersSts = "pre_alpha";							// Version status (pre-alpha, alpha, beta, rc, public, stable, obsolete)
$VerName = "Crane";							// Version name
$VFooter = "Squawk &quot;$VerName&quot; [Build: $VersNum ($VersSts)]";	// Optional build number footer, handy for testing and debugging

// These above variables are used for internal development only; there's no need to modify these
// unless you're doing development of some sort. See GOALS.txt for more info

/* MySQL settings*/

$dbserver = "localhost";	// MySQL server
$dbtcport = 3307		// MySQL port; normally not needed
$database = "user";		// MySQL database
$dbuser = "database";		// MySQL username
$dbpass = "password";		// MySQL password

$mysqlcon = mysql_connect($dbserver, $dbuser, $dbpass);		// MySQL connection driver
$mysqldbs = mysql_select_db($database, $mysqlcon);		// MySQL database select

/* Directory settings */

$BaseURL = "http://yoursite.com";			// Base URL, no trailing slash!
$imgdir = "$BaseURL/img";				// Image directory
$usrdir = "$BaseURL/usr";				// User directory
$cclogo = "$imgdir/logo.png";				// Main logo image (change to whatever)
$loginf = "$BaseURL/login.php";				// Login page

/* Site settings */

$SiteName = "My Website's Name";			// Your website's name
$SiteMotto = "Just another Squawk Blog";		// Your site's motto, byline, etc...
$ccauthor = "Bob Robertson";				// Your name or pseudonym
$admincta = "bob@yoursite.invalid";			// Admin contact email
$ccfooter = "Copyright &copy; $ccauthor, 2011";		// An optional footnote, useful for copyright notices or other minutia
$dateshrt = date("M j");				// Short date format, ex: Jan 1
$datelong = date("M d, Y");				// Long date format, ex: Jan 01, 2011
$dateunix = date("U");					// UNIX time
$datetime = date("h:i A");				// Time, ex: 1:15 AM

/* Functions */

// These functions manage post generation
function GetPosts()									// Get 10 most recent posts
{
	$gpQuery = "SELECT * FROM cdc_posts ORDER BY ID DESC LIMIT 0, 10";		// SQL query to send to database
	$gpResult = mysql_query($gpQuery);						// Run query
	
	while($gpRow = mysql_fetch_array($gpResult))					// Put results into array, loop until all rows accounted for
	{
		$datemix = date("d M, Y \[h:i A \E\S\T\]", $gpRow['date']);		// Convert UNIX time to DD MM, YYYY [HH:MM AM EST]
		
		echo									// Build entries into XHTML
		"<!-- Begin Post Header -->
		<p><strong>".$gpRow['title']."</strong>
		<br /><em>By ".$gpRow['auth']."</em>
		<br />Date: $datemix</p>
		<!-- End Post Header -->
		<!-- Begin Post Body -->".
		$gpRow['body']."
		<!-- End Post Body -->
		<p>&nbsp;----&nbsp;</p>";
	}
}

function GetMorePosts()
{
	$gpmQuery = "SELECT * FROM cdc_posts ORDER BY ID DESC LIMIT 10, 10";		// Get next grouping of posts
	$gpmResult = mysql_query($gpmQuery);						
	
	while($gpmRow = mysql_fetch_array($gpmResult))
	{
		$datemix = date("d M, Y \[h:i A \E\S\T\]", $gpmRow['date']);

		echo									// Build entries into XHTML
		"<!-- Begin Post Header -->
		<p><strong>".$gpRow['title']."</strong>
		<br /><em>By ".$gpRow['auth']."</em>
		<br />Date: $datemix</p>
		<!-- End Post Header -->
		<!-- Begin Post Body -->".
		$gpRow['body']."
		<!-- End Post Body -->
		<p>&nbsp;----&nbsp;</p>";
	}
}

?>
